﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.OleDb;
using System.Configuration;

namespace DeansWsccProject
{
    public partial class rss : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            OleDbConnection oleDbConn = new OleDbConnection(ConfigurationManager.ConnectionStrings["DeansWsccProjectConnectionString"].ConnectionString);
            string SqlString = "SELECT eBookTitle, eBookRating, eBookReleaseDate, eBookDescription, eBookDownloadUrl FROM eBooks ORDER BY eBookTitle";
            OleDbCommand cmd = new OleDbCommand(SqlString, oleDbConn);
            cmd.CommandType = CommandType.Text;
            oleDbConn.Open();
            OleDbDataReader dataReader = cmd.ExecuteReader();
            repeaterRSS.DataSource = dataReader;
            repeaterRSS.DataBind(); 
        }

        protected string formatForXML(object input)
        {
            // cast the input to a string
            string data = input.ToString();

            // replace those characters disallowed in XML documents
            data = data.Replace("&", "&amp;");
            data = data.Replace("\"", "&quot;");
            data = data.Replace("'", "&apos;");
            data = data.Replace("<", "&lt;");
            data = data.Replace(">", "&gt;");

            return data;
        }
    }
}